/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.helpdesk.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author JK
 */
@Entity
@Table(name = "Rankings")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Rankings.findAll", query = "SELECT r FROM Rankings r"),
    @NamedQuery(name = "Rankings.findById", query = "SELECT r FROM Rankings r WHERE r.id = :id"),
    @NamedQuery(name = "Rankings.findByTotalRanking", query = "SELECT r FROM Rankings r WHERE r.totalRanking = :totalRanking"),
    @NamedQuery(name = "Rankings.findByTotalPoint", query = "SELECT r FROM Rankings r WHERE r.totalPoint = :totalPoint")})
public class Rankings implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Column(name = "TotalRanking")
    private Integer totalRanking;
    @Column(name = "TotalPoint")
    private Integer totalPoint;
    @OneToMany(mappedBy = "rankingID")
    private List<Posts> postsList;

    public Rankings() {
    }

    public Rankings(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getTotalRanking() {
        return totalRanking;
    }

    public void setTotalRanking(Integer totalRanking) {
        this.totalRanking = totalRanking;
    }

    public Integer getTotalPoint() {
        return totalPoint;
    }

    public void setTotalPoint(Integer totalPoint) {
        this.totalPoint = totalPoint;
    }

    @XmlTransient
    public List<Posts> getPostsList() {
        return postsList;
    }

    public void setPostsList(List<Posts> postsList) {
        this.postsList = postsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rankings)) {
            return false;
        }
        Rankings other = (Rankings) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.helpdesk.entities.Rankings[ id=" + id + " ]";
    }
    
}
